package day01;

public abstract class Test3 {
	int a =0;
	public static void main(String[] args) {
		int arr[] = new int []{23,43,94,78,56,76,88,99};
//		for (int i : arr) {
//			System.out.print(i);
//		}
		arr = ao(arr);
		for (int i : arr) {
			System.out.print(i+",");
		}
//		int a = test(arr, 56);
//		System.out.println(a);
	}
	public static int[] ao(int arr[]){
		int temp = 0;
		for(int i=0;i<arr.length-1;i++){
			for(int j =0;j<arr.length-i-1;j++){
				if(arr[j]>arr[j+1]){
					temp = arr[j];
					arr[j]=arr[j+1];
					arr[j+1]=temp;
				}
			}
		}
		return arr;
	}
	public static int test(int arr[] ,int key){
		int middle = 0;
		int high =arr.length-1;
		int low=0;
		while(low<=high){
			middle =(low+high)/2;
			if(key==arr[middle]){
				return middle;
			}else if(key>arr[middle]){
				low=middle+1;
			}else{
				high=middle-1;
			}
		}
		return -1;
	}
}
